package com.ad_hccm.dao.Week;

import com.ad_hccm.domain.Week.RecrudescenceInducingFactors;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * TODO 复发诱发或加重因素
 */
@Mapper
public interface RecrudescenceInducingFactorsDao {
    @Insert("insert into recrudescence_inducing_factors value(#{id}, #{week}, #{fatigue}, #{diet}, #{infect}, #{menstruation}, #{medicine}, #{season}, #{traumaSurgery}, #{spirit}, #{other}, #{date})")
    public boolean save(RecrudescenceInducingFactors domain);

    @Update("update recrudescence_inducing_factors set fatigue = #{fatigue}, diet = #{diet}, infect = #{infect}, menstruation = #{menstruation}, medicine = #{medicine}, season = #{season}, traumaSurgery = #{traumaSurgery}, spirit = #{spirit}, other = #{other} where id=#{id} and date = #{date}")
    public boolean update(RecrudescenceInducingFactors domain);

    @Select("select * from recrudescence_inducing_factors where id=#{id}")
    public List<RecrudescenceInducingFactors> getById(String id);

    @Select("select * from recrudescence_inducing_factors")
    public List<RecrudescenceInducingFactors> getAll();
}